package com.matt.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.matt.commons.model.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * @author mengzhichao
 * @create 2025-02-20-10:44
 */
@Entity
@Data
@Table(name = "rel_children_memorandum")
@NoArgsConstructor
@EqualsAndHashCode(callSuper=false)
public class RelChildrenMemorandum extends Model {

    private String chldrenId;

    private String classesId;

    private String name;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    private String createUserId;

    private String createUserName;

    @OneToMany(mappedBy = "relChildrenMemorandumId", cascade = CascadeType.DETACH, fetch = FetchType.EAGER)
    @OrderBy("createTime DESC")
    private List<ChildrenMemorandum> childrenMemorandums;

}
